package com.darcytech.debezium.common.utils;

import java.util.concurrent.ConcurrentHashMap;

public class StringLockUtils {

    private final static ConcurrentHashMap<String, Object> lockCache = new ConcurrentHashMap<>();

    public static Object getOrCreateStringLock(String lockName) {
        return lockCache.computeIfAbsent(lockName, k -> new Object());
    }

    public static Object getStringLock(String lockName) {
        return lockCache.get(lockName);
    }

    public static void removeStringLock(String lockName) {
        lockCache.remove(lockName);
    }

}
